package com.guacha;

import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import java.util.function.Consumer;

public class WeiXinGongZongHao implements  FaBu{

    // List
        List<Observe> observeSet = new ArrayList<>();
    @Override
    public void addObserve(Observe observe) {
             observeSet.add(observe);
    }

    @Override
    public void del(Observe observe) {
        observeSet.remove(observe);

    }

    @Override
    public void sendMsg(String msg) {
        // 把这个消息  推送给所有的订阅者

        // 订阅者更新消息
        observeSet.forEach(observe -> observe.updateMsg(msg));

    }
}
